package xyz.thoughtset.viewer.modules.step.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.util.ObjectUtils;
import xyz.thoughtset.viewer.modules.step.entity.block.BlockBodyEle;

import java.util.List;

@Data
@NoArgsConstructor
@AllArgsConstructor
public abstract class BaseBlockBody {
    protected List<BlockBodyEle> bodyEles;
    protected String bodyType = supportType().getType();

    public int listSize() {
        return !ObjectUtils.isEmpty(bodyEles) ? bodyEles.size()+2 : 0;
    }

    protected abstract BlockTypeEnum supportType();

    public String getBodyType() {
        return supportType().getType();
    }

    public void setBodyType(String bodyType) {
        this.bodyType = supportType().getType();
    }

}
